home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / Classes / RCString / chart2.m < prev    next >
Text File  |  1995-06-12  |  812b  |  36 lines

  1. // testing of more of the Characters category.
  2. #import <stdio.h>
  3. #import <stdlib.h>
  4. #import <signal.h>
  5. #import <fcntl.h>
  6. #import <string.h>
  7. #import <sys/time.h>
  8. #import <RCString.h>
  9.  
  10. int
  11. main(int c, char **v)
  12. {
  13.     RCString *oString;
  14.     int iChar, iIndex;
  15.  
  16.     // args assumed to be: cmd string char index
  17.     iChar = *v[2];
  18.     iIndex = atoi(v[3]);
  19.  
  20.     oString = [RCString newFromString:v[1]];
  21.     if (oString) {
  22.         printf("substituting %c at index %d into \"%s\": \"%s\"\n",
  23.             iChar, iIndex, v[1],
  24.             [[oString substituteCharacter:iChar at:iIndex] data]);
  25.  
  26.         printf("inserting %c at index %d into \"%s\": \"%s\"\n",
  27.             iChar, iIndex, v[1],
  28.             [[[oString replaceWithAsciiString:v[1]] insertCharacter:iChar at:iIndex] data]);
  29.         [oString free];
  30.     } else {
  31.         fprintf(stderr, "newFromString: failure\n");
  32.         return(1);
  33.     }
  34.     return(0);
  35. }
  36.